﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;

namespace JQueryDemo
{
    public partial class GetHelpText : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            string helpTextKey = Request["helpTextKey"];
            divResult.InnerText = GetHelpTextByKey(helpTextKey);
        }

        private string GetHelpTextByKey(string key)
        {
            string helpText = string.Empty;
            using(SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["DBCS"].ConnectionString ))
            {
                SqlCommand cmd = new SqlCommand("spGetHelpTextByKey", conn);
                cmd.CommandType = CommandType.StoredProcedure;
                SqlParameter parameter= new SqlParameter("@HelpTextKey",key );
                cmd.Parameters.Add(parameter);
                conn.Open();
                helpText = cmd.ExecuteScalar().ToString();


            }


            return helpText;


        }
    }
}